<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTableGoods extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->id();
            $table->string('name', 255)->comment('商品名称');
            $table->string('description', 255)->comment('商品描述');
            $table->integer('goods_class_id')->default(0)->comment('分类ID');
            $table->string('goods_class_path', 32)->nullable()->comment('分类路径');
            $table->integer('brand_id')->default(0)->comment('品牌ID');
            $table->unsignedTinyInteger('putaway')->default(0)->comment('上架状态 1 上架 0 下架');
            $table->unsignedTinyInteger('one_attr')->default(1)->comment('单规格 1 单规格  2 多规格');
            $table->float('price', 8, 2)->default('0.00')->comment('商品价格');
            $table->float('cost_price', 8, 2)->default('0.00')->comment('成本价格');
            $table->float('line_price', 8, 2)->default('0.00')->comment('划线价格');
            $table->integer('stock_num')->default(0)->comment('库存数量');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods');
    }
}
